// CNode.h: interface for the CNode class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CNODE_H__B81FFED8_25EB_471F_B1DC_3ACB1AA61BE6__INCLUDED_)
#define AFX_CNODE_H__B81FFED8_25EB_471F_B1DC_3ACB1AA61BE6__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "../types.h"
#include "InputStream.h"
#include "OutputStream.h"
class CNode  
{

protected:
    int    port;  /* Contiene el valor del puerto de la conexion */
	std::string  ipAddress;      /* Contiene la direccion IP de la conexion */
    SOCKET csocket;  /* Contiene la informacion del socket de la conexion */
	InputStream in;
	OutputStream out;
	bool closed;

public:

	CNode();

	CNode(SOCKET csocket);
	
	virtual ~CNode();

	void setPort( int puerto) { this->port = puerto; }

	int getPort() { return this->port; }

	void setipAddress(std::string& ip) { this->ipAddress = ip; }

	const std::string& getipAddress() { return this->ipAddress; }

	OutputStream& getOutputStream() { return this->out;}

	InputStream& getInputStream() { return this->in; }

	bool isConnected();

	void close();
	
};

#endif // !defined(AFX_CNODE_H__B81FFED8_25EB_471F_B1DC_3ACB1AA61BE6__INCLUDED_)
